﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Lokasi.aspx.vb" Inherits="bisaska.Lokasi" %>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<form id="form1" runat="server">
<asp:ScriptManager ID="DivisiScriptManager" runat="server" EnablePartialRendering="true" EnablePageMethods="true"/>
<asp:UpdatePanel ID="up" runat="server">
<ContentTemplate>
<asp:GridView 
    ID="GridView1" 
    runat="server" 
    AllowPaging="True" 
    AllowSorting="True" 
    AutoGenerateColumns="False" 
    CellPadding="4" 
    DataKeyNames="id_lokasi" 
    DataSourceID="t_mst_lokasi_source" 
    GridLines="None" 
    AlternatingRowStyle-CssClass="odd"
    CssClass="table-data">
<Columns>
    <asp:BoundField DataField="id_lokasi" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="id_lokasi" />
    <asp:BoundField DataField="kode_lokasi" HeaderText="Kode Lokasi" SortExpression="kode_lokasi" />
    <asp:BoundField DataField="kode_divisi" HeaderText="kode_divisi" SortExpression="kode_divisi" />
    <asp:BoundField DataField="is_active" HeaderText="is_active" ReadOnly="True" SortExpression="is_active" />
    <asp:BoundField DataField="tgl_update" HeaderText="tgl_update" SortExpression="tgl_update" />
    <asp:CommandField ShowSelectButton="True" SelectText="Edit" />
    <asp:TemplateField>
      <ItemTemplate>
        <asp:LinkButton ID="deleteButton" runat="server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Hapus data?');" />
      </ItemTemplate>
    </asp:TemplateField>
    <asp:ButtonField CommandName="btnCopy" Text="Copy" />
</Columns>
</asp:GridView>
<div class="paging">
  <em><asp:Button ID="Button3" runat="server" Text="Add New" CausesValidation="False" CssClass="button" />  </em><div style="clear:both;"></div>
</div>              
<table runat = "server" id="tabel1" cellpadding="0" cellspacing="2" border="0" class="table-form">
  <tr>
    <th>Kode Lokasi</th>
    <td>
        <asp:TextBox id="textbox1" runat="server" MaxLength="12"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="textbox1" ErrorMessage="*"></asp:RequiredFieldValidator>
    </td>
  </tr>
  <tr>
    <th>Status</th>
    <td>
      <asp:DropDownList ID="dropdownlist1" runat="server">
        <asp:ListItem Value="0">Aktif</asp:ListItem>
        <asp:ListItem Value="1">Pasif</asp:ListItem>
      </asp:DropDownList></td>
  </tr>
  <tr>
    <th>Divisi</th>
    <td>
        <asp:DropDownList 
            ID="dropdownlist2" 
            runat="server" 
            DataSourceID="t_mst_divisi_source" 
            DataTextField="kode_divisi" 
            DataValueField="kode_divisi">
        </asp:DropDownList>
    </td>
  </tr>
  <tr>
    <td></td>
    <td>
      <asp:Button ID="button1" runat="server" Text="Save" CssClass="button"></asp:Button>
      <asp:Button ID="button2" runat="server" Text="Cancel" CssClass="button" CausesValidation="False"></asp:Button>
    </td>
  </tr>
</table>
<asp:SqlDataSource 
    ID="t_mst_lokasi_source" 
    runat="server" 
    ConnectionString="<%$ ConnectionStrings:bisaska %>" SelectCommand="select a.id_lokasi,kode_lokasi,b.kode_divisi,is_active= case a.is_active when 0 then 'Aktif' else 'Pasif' end, a.tgl_update from T_MST_LOKASI a join T_MST_Divisi b on a.id_divisi = b.id_divisi "
    DeleteCommand="DELETE FROM [T_MST_LOKASI] WHERE [id_lokasi] = @id_lokasi">
    <DeleteParameters>
      <asp:Parameter Name="id_lokasi" Type="Int64" />
    </DeleteParameters>
</asp:SqlDataSource>
<asp:SqlDataSource 
    ID="t_mst_divisi_source" 
    runat="server" 
    ConnectionString="<%$ ConnectionStrings:bisaska %>" 
    SelectCommand="SELECT [id_divisi], [kode_divisi] FROM [T_MST_DIVISI]">
</asp:SqlDataSource>
</ContentTemplate>
</asp:UpdatePanel> 
</form>
</asp:Content>
